<script setup>
import { ref } from 'vue'
const kinds = ['服务态度', '付款流程', '无效货源', '信息虚假', '没有保障', '其他']
const kindSpan = ref()
const flag = [false, false, false, false, false, false]
function kindClick(kind) {
    if (flag.includes(true)) {
        if (flag[kind - 1]) {
            flag[kind - 1] = false
            kindSpan.value[kind - 1].style.color = ''
            kindSpan.value[kind - 1].style.border = ''
        }
    } else {
        if (!flag[kind - 1]) {
            flag[kind - 1] = true
            kindSpan.value[kind - 1].style.color = 'blue'
            kindSpan.value[kind - 1].style.border = '0.01rem solid blue'
            kindSpan.value[kind - 1].style.boxSizing = 'border-box'
        }
        else {
            flag[kind - 1] = false
            kindSpan.value[kind - 1].style.color = ''
            kindSpan.value[kind - 1].style.border = ''
        }
    }
}
</script>
<template>
    <div class="header">
        <span @click="$router.back()" class='back'>
            <van-icon name="arrow-left" />
        </span>
        <span>意见反馈</span>
    </div>
    <div class="main">

        <div class="u1705"><img src="/imgs/u1705.svg" alt=""></div>
        <div class="u1706">欢迎您提供宝贵的意见和建议</div>
        <div class="center">
            <span>反馈类型</span>
            <div class="kind-box">
                <span ref="kindSpan" v-for="item in 6" :key="item" class="kind" @click='kindClick(item)'>{{
                    kinds[item - 1]
                    }}</span>
            </div>
        </div>
        <div class=" bottom">
            <span>反馈内容</span>
            <textarea class="content"></textarea>
        </div>
    </div>
</template>
<style lang="scss" scoped>
.header {
    height: 0.6rem;
    background-color: #1678ff;
    font-size: 0.2rem;
    color: white;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0.1rem 0.1rem 0.1rem;
    box-sizing: border-box;
    position: relative;

    .back {
        position: absolute;
        left: 0.1rem;
    }

}

.main {
    height: calc(100% - 0.6rem);
    background-color: #f2f2f2;
    padding-top: 0.2rem;

    .u1705 {
        margin: 0 auto;
        width: 90%;
    }

    .u1706 {
        margin: 0 auto;
        width: 90%;
        text-align: center;
        font-size: 12px;
        color: #FEB028;
        background-color: rgba(242, 242, 242, 1);
        width: 160px;
        position: relative;
        top: -12px
    }

    .center,
    .bottom {
        width: 90%;
        height: 2rem;
        border-radius: 0.2rem;
        margin: 0.15rem 5%;
        background-color: white;
        font-size: 0.16rem;
        padding: 0.1rem 0 0 0.1rem;
        box-sizing: border-box;
    }

    .center {
        span {
            display: block;
            width: 100%;
            border-bottom: 0.01rem solid gray;
        }

        .kind-box {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            padding: 0.2rem 0.2rem;
            box-sizing: border-box;

            .kind {
                width: 30%;
                height: 0.4rem;
                border-radius: 0.4rem;
                background-color: #f2f2f2;
                text-align: center;
                line-height: 0.4rem;
                color: gray;
                margin: 3% 1%;
            }
        }


    }

    .bottom {
        .content {
            width: 90%;
            margin: 0.15rem 5%;
            height: 1rem;
            background-color: #f2f2f2;
            border-radius: 0.15rem;
            padding: 0.05rem;
        }
    }
}
</style>